package com.zycfc.zsf.boot.core.common;

import java.util.*;
import java.util.concurrent.*;

public enum MgsEnvEnum
{
    local("10.94.15.122", Integer.valueOf(9900)), 
    dev("10.94.15.122", Integer.valueOf(9900)), 
    sit("10.94.25.122", Integer.valueOf(9900)), 
    sit2("10.94.96.34", Integer.valueOf(9900)), 
    uat("10.94.35.122", Integer.valueOf(9900)), 
    tke("mgs-admin", Integer.valueOf(9900)), 
    u2("10.94.200.32", Integer.valueOf(9900)), 
    u3("10.94.204.32", Integer.valueOf(9900)), 
    auto("mgs-admin", Integer.valueOf(9900)), 
    mig("10.94.110.122", Integer.valueOf(9900)), 
    sec("10.94.210.65", Integer.valueOf(9900)), 
    cred("10.94.210.133", Integer.valueOf(9900)), 
    sit830("mgs-admin", Integer.valueOf(9900)), 
    uat830("mgs-admin", Integer.valueOf(9900)), 
    dev830("mgs-admin", Integer.valueOf(9900)), 
    pfm("10.94.40.120", Integer.valueOf(9900)), 
    uat3("mgs-admin", Integer.valueOf(9900)), 
    rc("10.16.10.191", Integer.valueOf(8200)), 
    prod("10.16.10.191", Integer.valueOf(8200));
    
    private static final String ILLEGAL_ENV = "\u975e\u6cd5\u7684\u73af\u5883\u53c2\u6570\uff1a";
    private String ip;
    private Integer port;
    private static Map<String, MgsEnvEnum> mgsEnvMap;
    
    private MgsEnvEnum(final String ip, final Integer port) {
        this.ip = ip;
        this.port = port;
    }
    
    public static MgsEnvEnum parse(final String env) {
        return MgsEnvEnum.mgsEnvMap.get(env);
    }
    
    public static void check(final String env) {
        if (parse(env) != null) {
            return;
        }
        throw new IllegalArgumentException("\u975e\u6cd5\u7684\u73af\u5883\u53c2\u6570\uff1a" + env);
    }
    
    public String getIp() {
        return this.ip;
    }
    
    public void setIp(final String ip) {
        this.ip = ip;
    }
    
    public Integer getPort() {
        return this.port;
    }
    
    public void setPort(final Integer port) {
        this.port = port;
    }
    
    static {
        MgsEnvEnum.mgsEnvMap = new ConcurrentHashMap<String, MgsEnvEnum>();
        for (final MgsEnvEnum mgsEnv : values()) {
            MgsEnvEnum.mgsEnvMap.put(mgsEnv.name(), mgsEnv);
        }
    }
}
